package top.fangw.common.rabbitmq;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.context.annotation.Bean;

/**
 * @description: 配置类
 * @author: fgw
 * @createDate: 2024/3/6
 */
@RequiredArgsConstructor
public class RabbitmqConfig {

    private final ConnectionFactory connectionFactory;
    @Bean
    public RabbitAdmin rabbitAdmin() {
        RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
        rabbitAdmin.setAutoStartup(true);
        return rabbitAdmin;
    }
}
